package com.happyfamily.springboot.crowdsourcingplatform.service.sun.impl;

import com.happyfamily.springboot.crowdsourcingplatform.dao.sun.BankDao;
import com.happyfamily.springboot.crowdsourcingplatform.model.Bank;
import com.happyfamily.springboot.crowdsourcingplatform.service.sun.BankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class BankServiceImpl implements BankService
{
	@Autowired(required = false)
	private BankDao bankDao;

	@Override
	public Bank getBank(String account)
	{
		return bankDao.getBank(account);
	}

	@Override
	public boolean deleteBank(String account)
	{
		boolean flag=false;
		int n=bankDao.deleteBank(account);
		if(n>0)
		{
			flag=true;
		}
		return flag;
	}

	@Override
	public boolean updateMoney(String money, String account)
	{
		boolean flag=false;
		int n=bankDao.updateMoney(money,account);
		if(n>0)
		{
			flag=true;
		}
		return flag;
	}

	@Override
	public boolean addBank(Bank bank)
	{
		boolean flag=false;
		int n=bankDao.addBank(bank);
		if(n>0)
		{
			flag=true;
		}
		return flag;
	}
}